<?php

namespace app\models\jasper;

use yii\base\NotSupportedException;

trait JasperApiAccountTrait
{
    /**
     * @param integer $pageNumber
     * @param boolean $pageNumberSpecified
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAccounts($pageNumber, $pageNumberSpecified)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'pageNumber' => $pageNumber,
                'pageNumberSpecified' => $pageNumberSpecified,
            ]
        );
    }

    /**
     * @param int[] $accountids
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAccountDetails($accountids)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'accountids' => $accountids,
            ]
        );
    }

    /**
     * @param int[] $accountids
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAccountDetailsTelkomseILBS($accountids)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'accountids' => $accountids,
            ]
        );
    }

    /**
     * @throws NotSupportedException
     */
    public function CreateAccount()
    {
        throw new NotSupportedException();
    }

    /**
     * @param string $accountName
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAccountIdByAcctName($accountName)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'accountName' => $accountName,
            ]
        );
    }

    /**
     * @param string $operatorAccountId
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAccountIdByOpAcctId($operatorAccountId)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'operatorAccountId' => $operatorAccountId,
            ]
        );
    }

    /**
     * @param string $operator
     * @param string $account
     * @param string $remoteOperator
     * @param string $remoteAccount
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAccountPeerStatus($operator, $account, $remoteOperator, $remoteAccount)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'operator' => $operator,
                'account' => $account,
                'remoteOperator' => $remoteOperator,
                'remoteAccount' => $remoteAccount,
            ]
        );
    }

    /**
     * @param string $operator
     * @param string $account
     * @param string $remoteOperator
     * @param string $remoteAccount
     * @param integer $status
     * @param string $secretKey
     * @return \stdClass
     * @throws \Exception
     */
    public function SetAccountPeerStatus($operator, $account, $remoteOperator, $remoteAccount, $status, $secretKey)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'operator' => $operator,
                'account' => $account,
                'remoteOperator' => $remoteOperator,
                'remoteAccount' => $remoteAccount,
                'status' => $status,
                'secretKey' => $secretKey,
            ]
        );
    }

    /**
     * @throws NotSupportedException
     */
    public function EditAccount()
    {
        throw new NotSupportedException();
    }
}
